<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>后台管理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="icon" href="../resource/myResource/img/bitbug_favicon.ico">
  <link rel="stylesheet" href="../resource/layui/css/layui.css"  media="all">
<style>
  .box{
    display: flex;
    align-items:Center;
  }
</style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo box" style="width:70%;">
          <img src="../resource/myResource/img/logo_school.png" style="height:70%;">
          <span style="font-style: italic;">报修管理系统</span>
        </div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right" style="margin-right: 20px">
            <li class="layui-nav-item" style="width:120px">
              <a href="javascript:;"  style="display: none" id="n1_0">未读消息<span id="no_read_num" class="layui-badge" style="display:none">0</span></a>
              <!-- <dl class="layui-nav-child" style="width:10px">
                <dd><a href="javascript:;"  style="display: none" id="n2_0">学生报修<span id="no_read_num_repair" class="layui-badge" style="display:none">0</span></a></dd>
                <dd><a href="javascript:;"  style="display: none" id="n3_0">公共报修<span id="no_read_num_other" class= "layui-badge" style="display:none">0</span></a></dd>
              </dl> -->
            </li>
            <li class="layui-nav-item" style="width:120px" >
              <a href="javascript:;" id="name"></a>
              <dl class="layui-nav-child" style="width:120px">
                  <dd><a href="javascript:;" style="display: none" id="n5_0">我的处理</a></dd>
                  <dd><a href="javascript:;" style="display: none" id="n6_0">修改密码</a></dd>
                  <dd><a href="javascript:;" style="display: none" id="n7_0">登出</a></dd>
              </dl>
            </li>
        </ul>
    </div> 
    <div class="layui-side layui-bg-black" >
      <div class="layui-side-scroll">
        <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
        <ul class="layui-nav layui-nav-tree"  lay-filter="test">
            <li class="layui-nav-item"><a href="javascript:;" id="n8_1">主页</a></li>
            <li class="layui-nav-item"> <!-- layui-nav-itemed"> -->
              <a class="" href="javascript:;"style="display: none" id="n9_1">报修</a>
              <dl class="layui-nav-child">
                <dd><a href="javascript:;"  style="display: none" id="n10_1">未读消息</a></dd>
                <li class="layui-nav-item"> <!-- layui-nav-itemed"> -->
                  <a class="" href="javascript:;" style="display: none" id="n11_1">报修历史</a>
                  <dl class="layui-nav-child">
                    <dd><a href="javascript:;" style="display: none" id="n12_1">宿舍报修</a></dd>
                    <dd><a href="javascript:;" style="display: none" id="n13_1">公共报修</a></dd>
                  </dl>
                </li>
                <li class="layui-nav-item"> <!-- layui-nav-itemed"> -->
                  <a class="" href="javascript:;"style="display: none" id="n14_1">拒绝报修</a>
                  <dl class="layui-nav-child">
                      <dd><a href="javascript:;" style="display: none" id="n15_1">学生拒报</a></dd>
                      <dd><a href="javascript:;" style="display: none" id="n16_1">公共拒报</a></dd>
                  </dl>
                </li>
                <li class="layui-nav-item"> <!-- layui-nav-itemed"> -->
                  <a class="" href="javascript:;" style="display: none" id="n17_1">报修录入</a>
                  <dl class="layui-nav-child">
                    <li class="layui-nav-item"> <!-- layui-nav-itemed"> -->
                      <a class="" href="javascript:;" style="display: none" id="n18_1">学生报修</a>
                      <dl class="layui-nav-child">
                        <dd><a href="javascript:;" style="display: none" id="n19_1">登记并处理</a></dd>
                        <dd><a href="javascript:;"  style="display: none" id="n20_1">登记</a></dd> 
                      </dl>
                    <li class="layui-nav-item"> <!-- layui-nav-itemed"> -->
                      <a class="" href="javascript:;" style="display: none" id="n21_1">公共报修</a>
                      <dl class="layui-nav-child">
                        <dd><a href="javascript:;"  style="display: none" id="n22_1">登记并处理</a></dd>
                        <dd><a href="javascript:;"  style="display: none" id="n23_1">登记</a></dd> 
                      </dl>
                    </dl>
                 </li>
                
              </dl>
            </li>  
           
            <li class="layui-nav-item">
              <a href="javascript:;" style="display: none" id="n24_1">维修师傅</a>
            </li>
            <li class="layui-nav-item">
              <a href="javascript:;" style="display: none" id="n25_1">个人中心</a> 
              <dl class="layui-nav-child">
                <dd><a href="javascript:;"  style="display: none" id="n26_1">个人信息</a></dd>
                <dd><a href="javascript:;"  style="display: none" id="n27_1">新增管理员</a></dd>
                <dd><a href="javascript:;"  style="display: none" id="n28_1">管理员管理</a></dd>
                <a href="javascript:;" style="display: none" id="n29_1">我的处理</a>
                <dl class="layui-nav-child">
                  <dd><a href="javascript:;" style="display: none" id="n30_1">学生报修</a></dd>
                  <dd><a href="javascript:;" style="display: none" id="n31_1">公共报修</a></dd>
                </dl>
                
              </dl>
            </li>
            <li class="layui-nav-item">
              <a href="javascript:;" style="display: none" id="n33_1">学生管理</a>
              <dl class="layui-nav-child">
                <dd><a href="javascript:;"  style="display: none" id="n34_1">学生信息</a></dd>
                <dd><a href="javascript:;" style="display: none"  id="n35_1">学生信息录入</a></dd>
              </dl>
            </li>

            <li class="layui-nav-item">
                <a href="javascript:;" style="display: none" id="n32_1">退出</a>
            </li>
            <li class="layui-nav-item" style="margin-bottom:100px"></li>
          </ul>
      </div>
</div>


      
<div class="layui-body">
  <!-- 内容主体区域 -->
  
<!-- 子页面 -->
<iframe id="page" src="personal/personal.html" frameborder="0" id="demoAdmin" style="width: 100%; height: 99%;"></iframe>           
               
          
</div>

<div class="layui-footer">
  <!-- 底部固定区域 -->
  © 福建农林大学 - 学生报修系统
</div>

<script src="../resource/jquery/dist/jquery.js"></script>
<script src="../resource/layui/layui.js" charset="utf-8"></script>
<script src="../resource/myResource/js/base.js"></script>
<script src="../resource/myResource/js/main.js"></script>
<script src="../resource/websockt/sockjs.min.js"></script>
<script src="../resource/websockt/stomp.min.js"></script>
<script src="../resource/myResource/js/webscoket/websocket.js"></script>


<script>
  
</script>


<script type="text/javascript">
  var id = getId();
    if(id == -1){//未登录
      window.location = "login/login.html";
    }
    $.ajax({
    url:head+'/page/getUrl?oid='+id,
    type:'POST',
    async:true,
    dataType:'JSON',
    success:function(data){
      var forest = data.data;
      $.each(forest,function(i,data){
         var dom = $('#'+data.elementId);
         dom.attr("style","");
         if(data.pageUrl != null)
           dom.attr("onclick",data.pageUrl); 
      })
    }
  });
    $.ajax({ //获取用户信息
      url:head+"/user/getUserInfo?id="+id,
      dataType:"json",
      type:"GET",
      success:function(redata){
          var data = redata.data;
          layui.use(['table'], function(){
              var str = $("#name").text();
              $("#name").html(data.name+'<span class="layui-nav-more"></span>');
          });
      }
  });
  function logout(){//登出
    $.ajax({
      url:head+"/user/logout",
      dataType:"json",
      type:"POST",
      success:function(redata){
        location.reload();
      }
    })
  }
  $.ajax({//获取未读消息数量
    url:head+"/repair/noReadNum",
      dataType:"json",
      type:"GET",
      data:{"managerId":id},
      success:function(redata){
          var data = redata.data;
          var repair =data.repair;          
          var other =data.other;
          if(repair > 0){
            $('#no_read_num').attr("style","");
            $('#no_read_num_repair').attr("style","");
            $('#no_read_num_other').attr("style","");
            $('#no_read_num').text(parseInt(repair)+parseInt(other));
            $('#no_read_num_repair').text(repair);
            $('#no_read_num_other').text(other);
            
          }
      }
  })
</script>
<script>
  $(function(){
    connect();//websocket连接
  })
  function pageChangeHeader(page){//点击头部未读信息
    $('#no_read_num').attr("style","display:none;");
    $('#no_read_num_repair').attr("style","display:none;");
    $('#no_read_num_other').attr("style","display:none;");
    pageChange(page);
  }
 
</script>

</body>
</html>